*************************************************************************************
*** Replication: Tepe, Markus and Ekaterina Widmer-Lytkina. 2026.                 ***
*** Populist Attitudes Among Civil Servants. A Source of Liberal Robustness?      ***
*** International Review of Administrative Sciences.                              ***
*************************************************************************************

* Cross-Sectional Evidence: The Case of Germany


****************************************************************************************
*** Load and merge p.dta and pgen.dta
****************************************************************************************

* SCIENTIFIC USE FILE of the of the ANCHOR DATASET of the GERMAN SOCIAL COHESION PANEL 2021 
* (SCP 2021_1 (Anchor)), released on July 18th, 2023.
* Get access via: https://fgz-risc-data.de/datenportal/datenangebot/german_social_cohesion_panel/

* Merge p and pgen
cd "~\FGZ_Project"
use "~\FGZ_Project\p.dta", clear
merge 1:1 pid using "~\FGZ_Project\pgen.dta"

cd "~\FGZ_Project\Resplication_Stata\Test_Results"
save data.dta, replace

****************************************************************************************
*** Recode Variables
****************************************************************************************

* Recode Populism Items 
replace ppopul01=. if ppopul01<1
replace ppopul02=. if ppopul02<1
replace ppopul03=. if ppopul03<1
replace ppopul04=. if ppopul04<1
replace ppopul05=. if ppopul05<1
replace ppopul06=. if ppopul06<1
replace ppopul07=. if ppopul07<1
replace ppopul08=. if ppopul08<1
replace ppopul09=. if ppopul09<1

* Alpha
alpha ppopul01 ppopul02 ppopul03 ppopul04 ppopul05 ppopul06 ppopul07 ppopul08 ppopul09
alpha ppopul01 ppopul02 ppopul03 
alpha ppopul04 ppopul05 ppopul06 
alpha ppopul07 ppopul08 ppopul09

*** Generate üopuism score
gen pop_score = (ppopul01 + ppopul02 + ppopul03 + ppopul04 + ppopul05 + ppopul06 + ppopul07 + ppopul08 + ppopul09) / 9
gen pop_score1 = (ppopul01 + ppopul02 + ppopul03) / 3 
gen pop_score2 = (ppopul04 + ppopul05 + ppopul06) / 3
gen pop_score3 = (ppopul07 + ppopul08 + ppopul09) / 3

*** Employment type
recode pempcond01 1=1 2=0 else=., gen(pub_empl)
replace poccstat=. if poccstat<1
recode poccstat 1=0 2=1 3=0 4=0 5=0 else=., gen(civ_serv)
gen pub_type = pub_empl
replace pub_type = 2 if pub_empl==1 & civ_serv==1
label define pub_type_lb 0 "Private empl." 1 "Public empl." 2 "Civil servant"
label values pub_type pub_type_lb
tab pub_type

*** Gender
replace pgender=. if pgender<1

*** Age
replace pbirthyear=. if pbirthyear<1
gen age = 2022- pbirthyear
recode age (17/30= 1 "Age 17-30") (31/40= 2 "Age 31-40") (41/50= 3 "Age 41-50") (51/60= 4 "Age 51-60") (61/max = 5  "Age 61 +" ), generate(agecat)

*** Education
replace pedu01=. if pedu01<1
replace pgisced11_scp = . if pgisced11_scp<1
recode pgisced11_scp (1/2= 1 "Prim. and lower sec.") (3= 2 "Upper secondary") (4= 3 "Post secondary") (6= 4 "BA or equiv.") (7 = 5  "MA or equiv." ) (8 = 6  "PhD or equiv." ), generate(educat)

*** Left right
replace  ppolatt=. if  ppolatt<0

** Social Ladder
replace pladder01=. if pladder01<0

*** HH net income
replace hhhincnet=. if hhhincnet<1
gen log_hhinc = log(hhhincnet)

*** General Trust
replace pgentrust =. if pgentrust<0

*** East vs. West acquaintance balance 
*** East 
replace  pgrpknow03=. if  pgrpknow03<0
replace  pgrpknow03=. if  pgrpknow03==7
*** West 
replace  pgrpknow04=. if  pgrpknow04<0
replace  pgrpknow04=. if  pgrpknow04==7
*** East West 
recode pgrpknow04 1=6 2=5 3=4 4=3 5=2 6=1, gen(pgrpknow04_rev)
gen ost_iso = (pgrpknow03 + pgrpknow04_rev) / 2

*** Marital status
replace pgfamstd_scp=. if pgfamstd_scp<=0
recode pgfamstd_scp 1=1 2=2 3=3 4=2 5=4 6=5 7=5., gen(marcat)
label define marcat_lb 1 "Married" 2 "Divorced or seperated " 3 "Single" 4 "Widowed" 5 "Same sex partnership"
label values marcat marcat_lb

*** Party vote (intended)
replace  psundvote=. if  psundvote<0
replace  psundvote=. if  psundvote>6

*** Public Employment Type by ISCO
gen     pub_empl_isco = pub_empl
replace pub_empl_isco =  9 if pub_empl==1

replace pub_empl_isco = . if pgisco08_scp==-10
replace pub_empl_isco = . if pgisco08_scp==-3
replace pub_empl_isco = . if pgisco08_scp==-2
replace pub_empl_isco = . if pgisco08_scp==-1

replace pub_empl_isco = 1 if pgisco08_scp==1111
replace pub_empl_isco = 1 if pgisco08_scp==1112
replace pub_empl_isco = 1 if pgisco08_scp==1114
replace pub_empl_isco = 1 if pgisco08_scp==1120
replace pub_empl_isco = 1 if pgisco08_scp==1211
replace pub_empl_isco = 1 if pgisco08_scp==1212
replace pub_empl_isco = 1 if pgisco08_scp==1213
replace pub_empl_isco = 1 if pgisco08_scp==1221
replace pub_empl_isco = 1 if pgisco08_scp==1330
replace pub_empl_isco = 1 if pgisco08_scp==1340
replace pub_empl_isco = 1 if pgisco08_scp==2611
replace pub_empl_isco = 1 if pgisco08_scp==2612
replace pub_empl_isco = 1 if pgisco08_scp==2619
replace pub_empl_isco = 1 if pgisco08_scp==3342
replace pub_empl_isco = 1 if pgisco08_scp==3343
replace pub_empl_isco = 1 if pgisco08_scp==3350
replace pub_empl_isco = 1 if pgisco08_scp==3351
replace pub_empl_isco = 1 if pgisco08_scp==3352
replace pub_empl_isco = 1 if pgisco08_scp==3353
replace pub_empl_isco = 1 if pgisco08_scp==3354
replace pub_empl_isco = 1 if pgisco08_scp==3359
replace pub_empl_isco = 1 if pgisco08_scp==3411
replace pub_empl_isco = 1 if pgisco08_scp==4110
replace pub_empl_isco = 1 if pgisco08_scp==4120
replace pub_empl_isco = 1 if pgisco08_scp==4311
replace pub_empl_isco = 1 if pgisco08_scp==4312

replace pub_empl_isco = 2 if pgisco08_scp==1341
replace pub_empl_isco = 2 if pgisco08_scp==1343
replace pub_empl_isco = 2 if pgisco08_scp==1344
replace pub_empl_isco = 2 if pgisco08_scp==1345
replace pub_empl_isco = 2 if pgisco08_scp==2300
replace pub_empl_isco = 2 if pgisco08_scp==2310
replace pub_empl_isco = 2 if pgisco08_scp==2320
replace pub_empl_isco = 2 if pgisco08_scp==2330
replace pub_empl_isco = 2 if pgisco08_scp==2341
replace pub_empl_isco = 2 if pgisco08_scp==2342
replace pub_empl_isco = 2 if pgisco08_scp==2351
replace pub_empl_isco = 2 if pgisco08_scp==2352
replace pub_empl_isco = 2 if pgisco08_scp==2353
replace pub_empl_isco = 2 if pgisco08_scp==2354
replace pub_empl_isco = 2 if pgisco08_scp==2355
replace pub_empl_isco = 2 if pgisco08_scp==2359
replace pub_empl_isco = 2 if pgisco08_scp==2635
replace pub_empl_isco = 2 if pgisco08_scp==3412
replace pub_empl_isco = 2 if pgisco08_scp==5300
replace pub_empl_isco = 2 if pgisco08_scp==5311
replace pub_empl_isco = 2 if pgisco08_scp==5312
replace pub_empl_isco = 2 if pgisco08_scp==5320
replace pub_empl_isco = 2 if pgisco08_scp==5321
replace pub_empl_isco = 2 if pgisco08_scp==5322
replace pub_empl_isco = 2 if pgisco08_scp==5329

replace pub_empl_isco = 3 if pgisco08_scp==1342
replace pub_empl_isco = 3 if pgisco08_scp==2211
replace pub_empl_isco = 3 if pgisco08_scp==2212
replace pub_empl_isco = 3 if pgisco08_scp==2221
replace pub_empl_isco = 3 if pgisco08_scp==2262
replace pub_empl_isco = 3 if pgisco08_scp==2263
replace pub_empl_isco = 3 if pgisco08_scp==2264
replace pub_empl_isco = 3 if pgisco08_scp==2266
replace pub_empl_isco = 3 if pgisco08_scp==2269
replace pub_empl_isco = 3 if pgisco08_scp==2634
replace pub_empl_isco = 3 if pgisco08_scp==3211
replace pub_empl_isco = 3 if pgisco08_scp==3212
replace pub_empl_isco = 3 if pgisco08_scp==3213
replace pub_empl_isco = 3 if pgisco08_scp==3214
replace pub_empl_isco = 3 if pgisco08_scp==3221
replace pub_empl_isco = 3 if pgisco08_scp==3230
replace pub_empl_isco = 3 if pgisco08_scp==3251
replace pub_empl_isco = 3 if pgisco08_scp==3252
replace pub_empl_isco = 3 if pgisco08_scp==3255
replace pub_empl_isco = 3 if pgisco08_scp==3256
replace pub_empl_isco = 3 if pgisco08_scp==3258
replace pub_empl_isco = 3 if pgisco08_scp==3259
replace pub_empl_isco = 3 if pgisco08_scp==3344

replace pub_empl_isco = 4 if pgisco08_scp==110
replace pub_empl_isco = 4 if pgisco08_scp==210
replace pub_empl_isco = 4 if pgisco08_scp==310
replace pub_empl_isco = 4 if pgisco08_scp==3355
replace pub_empl_isco = 4 if pgisco08_scp==5411
replace pub_empl_isco = 4 if pgisco08_scp==5412
replace pub_empl_isco = 4 if pgisco08_scp==5413
replace pub_empl_isco = 4 if pgisco08_scp==5414
replace pub_empl_isco = 4 if pgisco08_scp==5419

label define pub_empl_isco_lb 0 "Private empl" 1 "Admin" 2 "EduSocial" 3 "Health" 4 "Police Military Fire" 9 "Rest"
label values pub_empl_isco  pub_empl_isco_lb 
tab pub_empl_isco



****************************************************************************************
*** Analysis 
****************************************************************************************


************************
*** Appendix Table 3 ***
************************

reg pop_score        i.pub_type  ppolatt  i.pgender i.agecat i.educat ost_iso pladder01 i.marcat, robust
est store m1
reg pop_score1       i.pub_type  ppolatt  i.pgender i.agecat i.educat ost_iso pladder01 i.marcat, robust
est store m2
reg pop_score2       i.pub_type  ppolatt  i.pgender i.agecat i.educat ost_iso pladder01 i.marcat, robust
est store m3
reg pop_score3       i.pub_type  ppolatt  i.pgender i.agecat i.educat ost_iso pladder01 i.marcat, robust
est store m4
esttab m1 m2 m3 m4 using Appendix_Tab_A3.csv, r2 se brackets star(* 0.10 ** 0.05 *** 0.01) label nogaps  replace 


************************
*** Appendix Table 5 ***
************************

reg pop_score         i.pub_empl_isco  ppolatt  i.pgender i.agecat i.educat ost_iso pladder01 i.marcat, robust
est store m1
reg pop_score1        i.pub_empl_isco  ppolatt  i.pgender i.agecat i.educat ost_iso pladder01 i.marcat, robust
est store m2
reg pop_score2        i.pub_empl_isco  ppolatt  i.pgender i.agecat i.educat ost_iso pladder01 i.marcat, robust
est store m3
reg pop_score3        i.pub_empl_isco  ppolatt  i.pgender i.agecat i.educat ost_iso pladder01 i.marcat, robust
est store m4
esttab m1 m2 m3 m4 using Appendix_Tab_A5.csv, r2 se brackets star(* 0.10 ** 0.05 *** 0.01) label nogaps  replace 

****************
*** Figure 2 ***
****************

coefplot m1 m2 m3 m4, ///
    keep(1.pub_empl_isco) ///
    drop(_cons) xline(0) ///
    legend(order(2 "Pop. Score" 4 "Anti-Elitism" 6 "Pop. Sovereignty" 8 "Homogeneity") ///
           pos(6) rows(1) region(lstyle(none))) ///
    bycoefs ///
    ciopts(recast(rcap)) ///
    ytitle("Core Administration", size(*1.1)) ///
    ylabel(, nolabels noticks)
graph save fig1.gph, replace

coefplot m1 m2 m3 m4, ///
    keep(2.pub_empl_isco) ///
    drop(_cons) xline(0) ///
    legend(order(2 "Pop. Score" 4 "Anti-Elitism" 6 "Pop. Sovereignty" 8 "Homogeneity") ///
           pos(6) rows(1) region(lstyle(none))) ///
    bycoefs ///
    ciopts(recast(rcap)) ///
    ytitle("Education & Social", size(*1.1)) ///
    ylabel(, nolabels noticks)
graph save fig2.gph, replace

coefplot m1 m2 m3 m4, ///
    keep(3.pub_empl_isco) ///
    drop(_cons) xline(0) ///
    legend(order(2 "Pop. Score" 4 "Anti-Elitism" 6 "Pop. Sovereignty" 8 "Homogeneity") ///
           pos(6) rows(1) region(lstyle(none))) ///
    bycoefs ///
    ciopts(recast(rcap)) ///
    ytitle("Health", size(*1.1)) ///
    ylabel(, nolabels noticks)
graph save fig3.gph, replace

coefplot m1 m2 m3 m4, ///
    keep(4.pub_empl_isco) ///
    drop(_cons) xline(0) ///
    legend(order(2 "Pop. Score" 4 "Anti-Elitism" 6 "Pop. Sovereignty" 8 "Homogeneity") ///
           pos(6) rows(1) region(lstyle(none))) ///
    bycoefs ///
    ciopts(recast(rcap)) ///
    ytitle("Police, Military, Firefighters", size(*1.1)) ///
    ylabel(, nolabels noticks)
graph save fig4.gph, replace

graph combine fig1.gph fig2.gph fig3.gph fig4.gph,  xcommon col(1) xsize(4) ysize(6)
graph save Figure_2.gph, replace
	

****************
*** Figure 3 ***
****************

reg pop_score        i.pub_type##c.age      ppolatt  i.pgender          i.educat ost_iso pladder01 i.marcat, robust
margins i.pub_type, at(age=(18(1)65))
marginsplot, ///
    xlabel(20(5)65) ///
    recast(line) recastci(rarea) ciopt(color(%30)) ///
    title("") xtitle("Age (in years)") ytitle("Populism Score (Linear Prediction)") ///
    legend(position(6) ring(0) row(1) region(lstyle(none)))
graph save Figure_3.gph, replace


*************************
*** Appendix Figure 1 ***
*************************

reg pop_score        i.pub_type##c.educat c.age      ppolatt  i.pgender           ost_iso pladder01 i.marcat, robust
margins i.pub_type, at(educat=(1(1)5))
marginsplot, ///
    xlabel(1(1)5) ///
    recast(line) recastci(rarea) ciopt(color(%30)) ///
    title("") xtitle("Education Level") ytitle("Populism Score (Linear Prediction)") ///
    legend(position(6) ring(0) row(1) region(lstyle(none)))
graph save Appendix_Figure_A1.gph, replace


*************************
*** Appendix Figure 2 ***
*************************

label values ppolatt
reg pop_score        i.pub_type##c.ppolatt age        i.pgender          i.educat ost_iso pladder01 i.marcat, robust
margins i.pub_type, at(ppolatt=(0(1)10))
marginsplot, ///
    xlabel(0(1)10) ///
    recast(line) recastci(rarea) ciopt(color(%30)) ///
    title("") xtitle("Left-Right Scale") ytitle("Populism Score (Linear Prediction)")  ///
    legend(position(6) ring(0) row(1) region(lstyle(none)))
graph save Appendix_Figure_A2.gph, replace
	

*************************
*** Appendix Table  6 ***
*************************	

mlogit psundvote i.pub_type pop_score  ppolatt  i.pgender i.agecat i.educat ost_iso pladder01 i.marcat, robust base(1)
est store m1
esttab m1 using Appendix_Tab_A6.csv, r2 se brackets star(* 0.10 ** 0.05 *** 0.01) label nogaps  replace 

	
*************************
*** Appendix Figure 4 ***
*************************

mlogit psundvote i.pub_type pop_score  ppolatt  i.pgender i.agecat i.educat ost_iso pladder01 i.marcat, robust base(1)
margins, at(pop_score=(1(.5)5)) atmeans
marginsplot, xtitle("Composite Populism Score") ytitle("Probalitiy") legend(order(1 "SPD" 2 "CDU/CSU" 3 "FDP" 4 "Green" 5 "Left" 6 "AfD"))
graph save Appendix_Figure_A3.gph, replace


*** Erase
erase fig1.gph
erase fig2.gph
erase fig3.gph
erase fig4.gph
	
